from playwright.sync_api import sync_playwright
__USER_DATE_DIR_PATH__ = f"C:\\Temp\\ChromeTestData"
def run():
    with sync_playwright() as p:
        # 指定本地 Chrome 浏览器及插件路径
        browser = p.chromium.launch_persistent_context(
            user_data_dir=__USER_DATE_DIR_PATH__,
            headless=False,
            channel="chrome",  # 使用本地安装的 Chrome 而非 Chromium[7](@ref)
            args=[
                f"--disable-extensions-except=C:\\Users\\HP\\Desktop\\5.3.3_0",
                f"--load-extension=C:\\Users\\HP\\Desktop\\5.3.3_0"
            ]
        )
        page = browser.new_page()
        page.goto("https://www.bilibili.com/video/BV1EsooYGEWZ/")
        # 其他操作...
        browser.close()

if __name__ == "__main__":
    run()